package com.quyunshuo.edwinmusictwo.common.ui

import androidx.viewbinding.ViewBinding
import com.quyunshuo.edwinmusictwo.base.mvvm.v.BaseFrameFragment
import com.quyunshuo.edwinmusictwo.base.mvvm.vm.BaseViewModel
import com.quyunshuo.edwinmusictwo.common.utils.PhoneUtils
import me.jessyan.autosize.internal.CustomAdapt

/**
 * Fragment基类
 *
 * @author Qu Yunshuo
 * @since 8/27/20
 */
abstract class BaseFragment<VB : ViewBinding, VM : BaseViewModel> : BaseFrameFragment<VB, VM>(),CustomAdapt{
    // 使用更可靠的平板检测
    protected val isTablet: Boolean by lazy {
        resources.configuration.smallestScreenWidthDp >= 600
    }

    // 始终使用宽度基准（推荐）
    override fun isBaseOnWidth() = true

    override fun getSizeInDp(): Float {
        return if (isTablet) 720f else 360f
    }
}